1 //+------------------------------------------------------------------+
\r
2 //| Relative Vigor Index |
\r
3 //| Copyright © 2006, Luis Guilherme Damiani |
\r
4 //| http://www.damianifx.com.br |
\r
6 //+------------------------------------------------------------------+
\r
7 #property copyright "Copyright © 2006, Luis Guilherme Damiani"
\r
8 #property link "http://www.damianifx.com.br"
\r
10 #property indicator_buffers 2
\r
11 #property indicator_separate_window
\r
12 //#property indicator_chart_window
\r
14 #property indicator_color1 Yellow
\r
15 #property indicator_color2 Green
\r
16 //#property indicator_color3 Yellow
\r
18 //---- input parameters
\r
19 extern double length=10;
\r
20 //extern int maxbars=2000;
\r
23 //Price_Choice="----- Typical or Median --------------";
\r
24 //extern bool is_median=true;
\r
30 //double AuxBuffer[]; //Smooth
\r
32 //+------------------------------------------------------------------+
\r
33 //| Custom indicator initialization function |
\r
34 //+------------------------------------------------------------------+
\r
38 SetIndexStyle(0,DRAW_LINE);
\r
39 SetIndexBuffer(0,ind1);
\r
40 SetIndexStyle(1,DRAW_LINE);
\r
41 SetIndexBuffer(1,ind2);
\r
42 // SetIndexStyle(2,DRAW_LINE);
\r
43 // SetIndexBuffer(2,ind3);
\r
44 SetLevelValue(0,0.0);
\r
45 // SetLevelValue(1,-0.8);
\r
46 ArrayInitialize(ind1,0.0);
\r
47 ArrayInitialize(ind2,0.0);
\r
48 // ArrayInitialize(ind3,0.0);
\r
49 /// ArrayResize(AuxBuffer,maxbars+3);
\r
50 // ArrayInitialize(AuxBuffer,0.0);
\r
56 //+------------------------------------------------------------------+
\r
57 //| Custor indicator deinitialization function |
\r
58 //+------------------------------------------------------------------+
\r
66 //+------------------------------------------------------------------+
\r
67 //| Custom indicator iteration function |
\r
68 //+------------------------------------------------------------------+
\r
73 int counted_bars=IndicatorCounted();
\r
74 double num=0,denom=0;
\r
75 //---- check for possible errors
\r
76 if(counted_bars<0) return(-1);
\r
77 int limit=Bars-counted_bars;
\r
78 // if(limit>maxbars)limit=maxbars;
\r
79 //if (limit>Bars-1)limit=Bars-1;
\r
81 for (int i = limit; i>=0;i--)
\r
84 for(int j=0;j<length;j++)
\r
87 denom=denom+v2(i,j);
\r
89 if(denom!=0)ind1[i]=num/denom;
\r
97 double v1(int x,int y)
\r
100 pr=((Close[x+y]-Open[x+y])+2*(Close[x+y+1]-Open[x+y+1])+2*(Close[x+y+2]-Open[x+y+2])+(Close[x+y+3]-Open[x+y+3]))/6;
\r
104 double v2(int x,int y)
\r
107 pr=((High[x+y]-Low[x+y])+2*(High[x+y+1]-Low[x+y+1])+2*(High[x+y+2]-Low[x+y+2])+(High[x+y+3]-Low[x+y+3]))/6;
\r
110 //+------------------------------------------------------------------+